package com.igoal.dao;

import org.springframework.stereotype.Repository;

import com.igoal.entity.DataStatus;
import com.igoal.entity.UserThought;
import com.igoal.service.SaveResult;

@Repository("userThoughtDAO")
public class UserThoughtDAOImpl extends GenericDaoHibernate<UserThought, Long> implements
		UserThoughtDAO {

	public UserThoughtDAOImpl() {
		super(UserThought.class);
	}

	public int deletePost(Long id) {
		try {
			UserThought post = get(id);
			post.setStatus(DataStatus.DELETED);
			post = save(post);
			return SaveResult.SUCCESS;
		} catch (Exception e) {
			log.error("Cannot delete wall post id = " + id);
		}
		return SaveResult.FAIL;
	}

}
